package org.example;

import org.example.bean.product;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        //1.App类依赖于Product类
        product p=new product();
        p.setId( 1 );
        p.setName( "张三" );
        p.setPrice( 100 );
        System.out.println( p );
        //2.spring的方式来获取对象，创建了spring容器，读取配置文件beans.xml
        ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml");
        //从spring容器中获取对象
        product p1=(product) context.getBean("p1");
        System.out.println(p1);


    }
}
